package com.orangelife.mobile.widget;

import android.content.Context;
import android.util.AttributeSet;
import android.widget.*;

/**
 * 用于监听滑动事件
 * Created by YangWei
 * on 2016/3/7.
 */
public class MyScrollview extends android.widget.ScrollView {

    private ScrollViewListener listener;

    public void setScrollListener(ScrollViewListener listener) {
        this.listener = listener;
    }

   public  interface ScrollViewListener {
        void scorlling(int scrollY, int oldScrollY);
    }

    public MyScrollview(Context context) {
        super(context);
    }

    public MyScrollview(Context context, AttributeSet attrs) {
        super(context, attrs);
    }

    public MyScrollview(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
    }

    @Override
    protected void onScrollChanged(int l, int t, int oldl, int oldt) {
        super.onScrollChanged(l, t, oldl, oldt);
        listener.scorlling(t, oldt);
    }
}
